package com.example.alienware.layout610ly;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private TextView tv;
    private EditText et1,et2;
    private Button btn,btn1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.relativelayout2);
        init();
    }
    private void init() {
        et1 = (EditText) findViewById(R.id.editText);
        et2 = (EditText) findViewById(R.id.editText2);
        tv = (TextView) findViewById(R.id.textView);
        btn = (Button) findViewById(R.id.button);
        btn1 = (Button) findViewById(R.id.button1);
        btn1.setOnClickListener(this);
        btn.setOnClickListener(this);
    }

    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.button:
                String str1 = et1.getText().toString();
                String str2 = et2.getText().toString();
                Toast.makeText(this,str1,Toast.LENGTH_LONG).show();
                Toast.makeText(this,str2,Toast.LENGTH_LONG).show();
                break;
            case R.id.button1:
                Intent intent=new Intent(MainActivity.this,Relativelayout1.class);
                startActivity(intent);
                break;


        }

    }

}
